
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<html>
<head>
    <title>Title</title>
</head>
<body>


<table border="1">
  <tr>
    <td>id</td>
    <td>title</td>
    <td>publishTime</td>
  </tr>
  <c:forEach begin="1" end="${newslist.size()}" var="i">
    <c:if test="${newslist[i-1].getTitle().length()>20}">
      <tr>
        <td><c:out value=" ${newslist[i-1].getId() }"/></td>
        <td><c:out value=" ${newslist[i-1].getTitle().substring(0,20)}..."/></td>
        <td><c:out value=" ${newslist[i-1].getPublishTime() }"/></td>
      </tr>
    </c:if>
    <c:if test="${newslist[i-1].getTitle().length()<=20}">
      <tr>
        <td><c:out value=" ${newslist[i-1].getId() }"/></td>
        <td><c:out value=" ${newslist[i-1].getTitle()}"/></td>
        <td><c:out value=" ${newslist[i-1].getPublishTime() }"/></td>
      </tr>
    </c:if>
  </c:forEach>
</table>
</body>
</html>
